<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>模板之家</title>

    <!-- BOOTSTRAP STYLES-->
    <link href="../assets/css/bootstrap.css" rel="stylesheet"/>
    <!-- FONTAWESOME STYLES-->
    <link href="../assets/css/font-awesome.css" rel="stylesheet"/>
    <!--CUSTOM BASIC STYLES-->
    <link href="../assets/css/basic.css" rel="stylesheet"/>
    <!--CUSTOM MAIN STYLES-->
    <link href="../assets/css/custom.css" rel="stylesheet"/>
    <!-- GOOGLE FONTS-->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'/>
</head>
<body>
<div id="wrapper">
    <div id="page-inner">
        <div class="row">
            <div class="col-md-12">
                <h4 class="page-subhead-line">我的工作台 >> 个人资料</h4>
            </div>
        </div>
        <!-- /. ROW  -->
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <form role="form">
                            <div class="form-group">
                                <label>用户名</label>
                                <input id="userCode" class="form-control" type="text">

                            </div>
                            <div class="form-group">
                                <label>用户名称</label>
                                <input id="userName" class="form-control" type="text">

                            </div>
                            <div class="form-group">
                                <label>请输入旧密码</label>
                                <input id="userPassword" class="form-control" type="text">

                            </div>
                            <div class="form-group">
                                <label>请输入新密码</label>
                                <input id="newUserPassword" class="form-control" type="text">

                            </div>
                            <div class="form-group">
                                <label>性别</label>
                                <input id="sex" class="form-control" type="text">

                            </div>
                            <div class="form-group">
                                <label>年龄</label>
                                <input id="age" class="form-control" type="text">

                            </div>
                            <div class="form-group">
                                <label>入职日期</label>
                                <input id="creationTime" class="form-control" type="text">

                            </div>
                            <div class="form-group">
                                <label>离职日期</label>
                                <input id="dimissionDate" class="form-control" type="text">

                            </div>
                            <div class="form-group">
                                <label>联系电话</label>
                                <input id="phoneTel" class="form-control" type="text">
                            </div>
                            <div class="form-group">
                                <label>电子邮箱</label>
                                <input id="email" class="form-control" type="text">
                            </div>
                            <button type="submit" class="btn btn-info">提交</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /. PAGE INNER  -->
</div>
<!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
<!-- JQUERY SCRIPTS -->
<script src="../assets/js/jquery-1.10.2.js"></script>
<!-- BOOTSTRAP SCRIPTS -->
<script src="../assets/js/bootstrap.js"></script>

<script type="text/javascript">
    $(function () {
        initUserInfo();
    });

    function initUserInfo() {
        var userName = sessionStorage.getItem("userName");
        $.ajax({
            url: "http://localhost:8080/user/userinfo",
            type: "get",
            data: {"userName": userName},
            dataType: "json",
            success: function (data) {
                if (data.obj != null) {
                    $("#userCode").val(data.obj.userCode);
                    $("#userName").val(data.obj.userName);
                    $("#userPassword").val(data.obj.userPassword);
                    $("#sex").val(data.obj.sex);
                    $("#age").val(data.obj.age);
                    $("#creationTime").val(data.obj.creationTime);
                    $("#dimissionDate").val(data.obj.dimissionDate);
                    $("#phoneTel").val(data.obj.phoneTel);
                    $("#email").val(data.obj.email);
                    $("#email").val(data.obj.email);
                }
            },
            error: function () {
                console.log("与后台断开连接！！！");
            }
        })
    }
</script>
</body>
</html>
